Restoring Confluence for Functional Dependencies
نویسندگان
چکیده
Haskell-style functional dependencies allow the programmer to influence the type inference process by automatically deriving type improvement rules from class and instance declarations. Previous work demands that the dependency must fully cover all type parameters of a type class to guarantee confluence. Confluence is an important property to ensure that type inference is well-behaved. We restore confluence for non-full functional dependencies by giving a novel encoding of functional dependencies in terms of type families as supported by the Glasgow Haskell Compiler. We compare our method against another alternative constraint-propagation encoding due to Claus Reinke. Our work provides new insights in the connection between functional dependencies and type families, and in the relative trade-offs of rewriting based or constraint-propagation based type inference approaches.
منابع مشابه
Confluence for Non-Full Functional Dependencies
Previous work on type inference for functional dependencies demands that the dependency must fully cover all parameters of a type class to guarantee that the constraint solver is confluent. However, several interesting programs rely on non-full functional dependencies. For these, the underlying constraint is nonconfluent, and hence type inference for these programs is possibly ill-behaved. We i...
متن کاملObservable Confluence for Constraint Handling Rules
Constraint Handling Rules (CHRs) are a powerful rule based language for specifying constraint solvers. Critical for any rule based language is the notion of confluence, and for terminating CHRs there is a decidable test for confluence. But many CHR programs that in practice are confluent fail this confluence test. The problem is that the states that illustrate non-confluence are not reachable i...
متن کاملAccurate Functional Dependency Analysis for Constraint Handling Rules
Information about functional dependencies is used by modern CHR compilers for both optimisation and for further program analysis (e.g. confluence analysis). Before this work, CHR compilers relied on an ad hoc analysis for functional dependencies based on searching for rules of a particular form and the results from late storage analysis. We present a more formal functional dependency analysis o...
متن کاملAnalysis Techniques for Graph Transformation Systems
In software and system development, verification and validation means investigating artifacts in order to check if they fulfill the intended purposes. Graph transformation systems can be considered as precise models of computation where states are represented by graphs and state changes by rule-based graph transformations. This talk gives an overview of selected analysis techniques being availa...
متن کاملProving Ground Confluence of Equational Specifications Modulo Axioms
Terminating functional programs should be deterministic, i.e., should evaluate to a unique result, regardless of the evaluation order. For equational functional programs such determinism is exactly captured by the ground confluence property. For terminating equations this is equivalent to ground local confluence, which follows from local confluence. Checking local confluence by computing critic...
متن کامل